*********************************************
* Reassessing the Effects of Corporate Income Taxes on Mergers and Acquisitions Using			
* Empirical Advances in the Gravity Literature											
*		Bradley, Carril-Caccia and Yotov	
*										
* 		NTJ 2025								
*********************************************

*************************************************************************************************************
*************************************************************************************************************
*************************************************************************************************************
********************* Organization **************************************************************************
*************************************************************************************************************
*************************************************************************************************************
*************************************************************************************************************

**** The following code is divided in the following sections:
*1) How to calculate the Multilateral Resistance Index and the Multilateral Tax Resistance Index
*2) How to obtain the estimates reported in Section III, IV and V
*3) How to obtain the estimates reported in the Appendix

*** Note:
* ccode_scr refer to the country iso code from the acquirer country
* ccode_dest refer to the country iso code from the target country

clear
clear matrix
set more off

cd "C:\Data"


*************************************************************************************************************
*************************************************************************************************************
*************************************************************************************************************
********Multilateral Resistance Index and the Multilateral Tax Resistance Index******************************
*************************************************************************************************************
*************************************************************************************************************
*************************************************************************************************************
use ma_country_data.dta, clear


**** Indexes used in the main analysis and most sensitivity analysis


preserve
drop if ccode_scr==ccode_dest
collapse distw [aw=gdp_s], by(ccode_dest year)
gen rmt_imp_distgdp=ln(distw)
label var rmt_imp_distgdp "Destination MRT dist, w. GDP ne"
save rmt_imp_distgdp_ne.dta, replace
restore



preserve
drop if ccode_scr==ccode_dest
collapse distw [aw=tax_rate_scr], by(ccode_dest year)
gen rmt_imp_tax_dist=ln(distw)
label var rmt_imp_tax_dist "Destination MRT dist, w. tax ne"
save rmt_imp_tax_dist.dta, replace
restore


**** Indexes used in the sensitivity analysis presented in Table A9


ppml project lngdp_s lngdp_d lndistw contig comlang_off col_dep_ever lnun_dist allsanctions bitforce rta if ccode_scr!=ccode_dest

gen e_dist = _b[lndistw]
gen e_contig = _b[contig]
gen e_comlang_off = _b[comlang_off]
gen e_col_dep_ever = _b[col_dep_ever]
gen e_undist = _b[lnun_dist]
gen e_sanct = _b[allsanctions]
gen e_bit = _b[bitforce]
gen e_rta = _b[rta]


gen avg_trade_cost= exp(e_dist*lndistw + e_contig*contig + e_comlang_off*comlang_off + e_col_dep_ever*col_dep_ever + e_undist*lnun_dist + e_sanct*allsanctions + e_bit*bitforce + e_rta*rta)

gen fra_avg_trade_cost= 1/avg_trade_cost


preserve
drop if ccode_scr==ccode_dest
collapse fra_avg_trade_cost [aw=gdp_s], by(ccode_dest year)
gen rmt_imp=ln(fra_avg_trade_cost)  
label var rmt_imp "Destination MRT, w. GDP"
save rmtns_imp2, replace
restore


preserve
drop if ccode_scr==ccode_dest
collapse fra_avg_trade_cost [aw=tax_rate_scr], by(ccode_dest year)
gen rmt_imp_tax=ln(fra_avg_trade_cost)  
label var rmt_imp_tax "Destination MRT, w. tax"
save rmtns_imp_tax, replace
restore





*************************************************************************************************************
*************************************************************************************************************
*************************************************************************************************************
********Estimates reported in Section III, IV and V**********************************************************
*************************************************************************************************************
*************************************************************************************************************
*************************************************************************************************************

use ma_country_data.dta, clear

*** Add MR and MTR

merge m:1 ccode_dest year using rmt_imp_distgdp_ne.dta
drop _merge

merge m:1 ccode_dest year using rmt_imp_tax_dist.dta
drop _merge

*** International dummy
gen inter=0
replace inter=1 if ccode_scr!=ccode_dest
label var inter "International"

*** Variables interacted by the international dummy
gen i_tax_rate=tax_rate_dest*inter


local mylisto lngdp_d lnlabor_force_dest unemploy_d inflation_dest lnexchange  exports_dest lneco_freedom_h
foreach o of local mylisto {

gen i_`o'= `o'*inter

} 


*** Label variables

label var tax_rate_dest "CIT dest (\%)"
label var i_tax_rate "CIT dest (\%) x INT"
label var lndistw "Distance (log)"
label var contig "Contiguity"
label var comrelig "Religion"
label var comlang_off "Language"
label var col_dep_ever "Colonial ties"
label var rta "RTA"
label var bitforce "BIT" 
label var lnun_dist "Diplomatic distance (log)"
label var allsanctions "Any sanction"
label var lngdp_d "GDP (log)"
label var i_lngdp_d "GDP (log) x inter"
label var lnlabor_force_dest "Labor force (log)"
label var i_lnlabor_force_dest "Labor force (log) x INT"
label var unemploy_d "Unemployment rate"
label var i_unemploy_d "Unemployment rate x INT"
label var inflation_dest "Inflation rate"
label var i_inflation_dest "Inflation rate x INT"
label var lnexchange  "Exchange rate (log)"
label var i_lnexchange  "Exchange rate (log) x INT"
label var exports_dest "Exports (\%GDP)"
label var i_exports_dest "Exports (\%GDP) x INT"
label var lneco_freedom_h "Eco. Freedom (log)"
label var i_eco_freedom_h "Eco. Freedom (log) x INT"

label var lngdp_s "GDP scr (log)"
label var lngdppc_s "GDP pc scr  (log)"







**** Group of variables to be included in the regressions:
global pairdet lndistw contig  comlang_off col_dep_ever 
global controls lngdp_d lnlabor_force_dest unemploy_d inflation_dest lnexchange  exports_dest lneco_freedom_h
global controls2 lngdp_d i_lngdp_d lnlabor_force_dest i_lnlabor_force_dest unemploy_d i_unemploy_d inflation_dest i_inflation_dest lnexchange i_lnexchange  exports_dest i_exports_dest lneco_freedom_h i_eco_freedom_h
global controlsf i_lngdp_d i_lnlabor_force_dest i_unemploy_d i_inflation_dest i_lnexchange  i_exports_dest  i_eco_freedom_h 
global control_source lngdp_s lngdppc_s
global bilat rta bitforce  lnun_dist allsanctions
global controls_scr lngdp_s lnlabor_force_scr unemploy_s inflation_scr lnexchange_scr  exports_scr lneco_freedom_h_scr


**** Define fixed effects

egen pair=group(ccode_scr ccode_dest) /*  Country pair */
egen scr=group(ccode_scr) /* Aquirer FE  */
egen dest=group(ccode_dest) /*  Target FE */
egen oy=group(ccode_scr year) /* aquirer-year FE  */
egen dy=group(ccode_dest year) /* target-year FE  */
egen brdyr=group(inter year) /* International-year FE  */


********* Restrict sample so the sample of analysis is always the same and does not change as a result of including new independent variables or excluding domestic transactions:

****** Restrict sample:
ppmlhdfe project  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg7
gen sample=e(sample)
keep if sample==1
drop sample 




ppmlhdfe project tax_rate_dest  $pairdet $controls $bilat if ccode_scr!=ccode_dest, absorb(dest oy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store ereg1
gen sample_int=e(sample)

preserve
keep if sample_int==1
egen codeyear=group(ccode_dest year)
duplicates drop codeyear, force
keep ccode_dest year
gen sample_dest=1
save sample_dest.dta, replace
restore

preserve
keep if sample_int==1
egen codeyear=group(ccode_scr year)
duplicates drop ccode_scr year, force
keep ccode_scr year
gen sample_scr=1
save sample_scr.dta, replace
restore

merge m:1 ccode_dest year using sample_dest.dta
keep if _merge==3
drop _merge

merge m:1 ccode_scr year using sample_scr.dta
keep if _merge==3
drop _merge sample_dest sample_scr

ppmlhdfe project  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg7
keep if _est_ereg7==1



*******************************************************************
********************** Estimates from Table 3 (and Table A3)*******
*******************************************************************


ppmlhdfe project tax_rate_dest  $pairdet $controls $bilat if ccode_scr!=ccode_dest, d absorb(dest oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store ereg1


ppmlhdfe project tax_rate_dest $controls $bilat if ccode_scr!=ccode_dest, absorb(pair oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 ""
estadd local DO "No"
est store ereg2


ppmlhdfe project  tax_rate_dest $controls $bilat $rem_gdp_ne if ccode_scr!=ccode_dest, absorb(pair oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 ""
estadd local DO "No"
est store ereg3

ppmlhdfe project  tax_rate_dest $controls $bilat $rem_gdp_ne $rem_tax_ne if ccode_scr!=ccode_dest, absorb(pair oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 ""
estadd local DO "No"
est store ereg4

ppmlhdfe project  tax_rate_dest $controls $bilat $rem_gdp_ne $rem_tax_ne, absorb(pair oy brdyr) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg5

ppmlhdfe project  tax_rate_dest i_tax_rate $controls2 $bilat $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne, absorb(pair oy brdyr) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg6

ppmlhdfe project  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg7


esttab ereg1 ereg2 ereg3 ereg4 ereg5 ereg6 ereg7 using Table3.tex, pr2  ///
replace nocons mti("Naive" "Pair FEs" "MRT GDP" "MRT GDP \& tax" "Domestic" "$X_{jt}*Inter$" "Main") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(tax_rate_dest i_tax_rate $pairdet $bilat $controls2 $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne)  ///
order(tax_rate_dest i_tax_rate $pairdet $bilat $controls2 $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne )   ///
label nonotes s(num_n FE1 FE2 FE3 FE4 FE5 DO, label("Observations" "Origin-year" "Destination" "Destination-year" "Pair"  "International-year" "Domestic M\&As"))


**** IV analysis***********

*Note that this procedure patches lagged corporate tax rate data from a dataset which is constructed using inputs from Comtax under license.
*Next 20 lines would be obviated by preserving tax rate data back to 1993 in estimation dataset.
preserve
use "corptax.dta", clear	
keep ctry_code year corptaxrate
ren (ctry_code corptaxrate) (iso2_dest i_tax_rate)
sort iso2_dest year
gen l1_tax_rate = i_tax_rate[_n-1] if iso2_dest==iso2_dest[_n-1] & year==year[_n-1]+1
gen l2_tax_rate = i_tax_rate[_n-2] if iso2_dest==iso2_dest[_n-2] & year==year[_n-2]+2
keep if year>=1995
save "tmp_CIT.dta"
restore

*Define lagged tax rate instruments
preserve
xtset pair year
gen l1_tax_rate = l.i_tax_rate
gen l2_tax_rate = l2.i_tax_rate

merge m:1 iso2_dest year using "tmp_CIT.dta", update keep(1 3 4 5) nogen
cap erase "tmp_CIT.dta"
replace l1_tax_rate = l1_tax_rate*inter
replace l2_tax_rate = l2_tax_rate*inter

qui ppmlhdfe project l1_tax_rate l2_tax_rate $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(i.oy i.dy i.pair i.brdyr) vce(cluster pair)
	/*Reduced form spec - establishes e(sample)*/
keep if e(sample)

cap noi program drop boot_CF
program boot_CF, eclass
   cap drop resid
   reghdfe i_tax_rate l1_tax_rate l2_tax_rate $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(i.oy i.dy i.pair i.brdyr) residuals(resid)
   ppmlhdfe project i_tax_rate resid $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(i.oy i.dy i.pair i.brdyr)
end

xtset, clear
bootstrap, reps(200) seed(1234) noisily cluster(pair) idcluster(pairid_cl): boot_CF
restore



*******************************************************************
********************** Estimates Figure 3**************************
*******************************************************************
local mylistd	1996	1997	1998	1999	2000	2001	2002	2003	2004	2005	2006	2007	2008	2009	2010	2011	2012	2013	2014	2015	2016	2017	2018	2019

 foreach d of local mylistd {
gen inter`d'=0
replace inter`d'=1 if year==`d' & inter==1
label var inter`d' "`d'"
}


global international inter1996 inter1997 inter1998 inter1999 inter2000 inter2001 inter2002 inter2003 inter2004 inter2005 inter2006 inter2007 inter2008 inter2009 inter2010 inter2011 inter2012 inter2013 inter2014 inter2015 inter2016 inter2017 inter2018 inter2019


ppmlhdfe project  tax_rate_dest $controls $bilat $rem_gdp_ne $rem_tax_ne $international, absorb(oy pair) vce(cluster pair) sep(fe)
est store bor1


coefplot (bor1, mcolor(blue)  offset(0) ciopts(recast(rarea)  lwidth(0) color(blue%50) fintensity(40))),  keep($international) vertical yline(0)   xlabel(,labsize(vsmall))  ylabel(-0.4(0.2)0.4 ,labsize(vsmall) nogrid) graphregion(color(white)) plotregion (margin(b = 0)) aspect(0.60)
graph save "Graph" "Figure3.gph", replace
graph export "Figure3.png", as(png) name("Graph") replace
graph export "Figure3.pdf", as(pdf) name("Graph") replace
graph export "Figure3.eps", as(eps) name("Graph") replace




*******************************************************************
********************** Estimates from Table 4 (and Table A5)*******
*******************************************************************



ppmlhdfe project  tax_rate_dest i_tax_rate $pairdet $controls2 $bilat $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne, d absorb(dest oy brdyr) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg7a



ppmlhdfe project  i_tax_rate $pairdet  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, d absorb(oy brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 ""
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg7b



ppmlhdfe project  tax_rate_dest i_tax_rate $controls2 $bilat $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne, d absorb(pair oy brdyr) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg6o


ppmlhdfe project  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg7o




esttab ereg7a ereg7b ereg6o ereg7o  using Tabl4.tex, pr2  ///
replace nocons mti("No pair" "No pair" "Xint" "Main") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(tax_rate_dest i_tax_rate $pairdet $bilat $controls2 $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne)  ///
order(tax_rate_dest i_tax_rate $pairdet $bilat $controls2 $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne )   ///
label nonotes s(num_n  FE1 FE2 FE3 FE4 FE5 DO, label("Observations"  "Origin-year" "Destination" "Destination-year" "Pair"  "International-year" "Domestic M\&As"))



*******************************************************************
********************** Estimates Figure 4**************************
*******************************************************************


local mylistd	1995 1996	1997	1998	1999	2000	2001	2002	2003	2004	2005	2006	2007	2008	2009	2010	2011	2012	2013	2014	2015	2016	2017	2018	2019

 foreach d of local mylistd {
gen inter`d'_cit=inter`d'*i_tax_rate
label var inter`d'_cit "`d'"
}



global intcit inter1995_cit inter1996_cit inter1997_cit inter1998_cit inter1999_cit inter2000_cit inter2001_cit inter2002_cit inter2003_cit inter2004_cit inter2005_cit inter2006_cit inter2007_cit inter2008_cit inter2009_cit inter2010_cit inter2011_cit inter2012_cit inter2013_cit inter2014_cit inter2015_cit inter2016_cit inter2017_cit inter2018_cit inter2019_cit



ppmlhdfe project   $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne $international $intcit, absorb(oy pair dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store cite



coefplot (cite, mcolor(blue)  offset(0) levels(95)),  keep($intcit) order($intcit) vertical yline(0) xtitle("Estimated coefficient", size(vsmall))   xlabel(,labsize(vsmall))  ylabel(-0.03(0.005)0.02 ,labsize(vsmall) nogrid) graphregion(color(white)) plotregion (margin(b = 0)) aspect(0.60)
graph save "Graph" "Figure4.gph", replace
graph export "Figure4.png", as(png) name("Graph") replace
graph export "Figure4.pdf", as(pdf) name("Graph") replace
graph export "Figure4.eps", as(eps) name("Graph") replace



*******************************************************************
********************** Estimates Figure 5**************************
*******************************************************************

encode iso2_dest, gen(iso2num)

tabulate iso2_dest, gen(is_)



foreach var of varlist is_1 is_2 is_3 is_4 is_5 is_6 is_7 is_8 is_9 is_10 is_11 is_12 is_13 is_14 is_15 is_16 is_17 is_18 is_19 is_20 is_21 is_22 is_23 is_24 is_25 is_26 is_27 is_28 is_29 is_30 is_31 is_32 is_33 is_34 is_35 is_36 is_37 is_38 is_39 is_40 is_41 is_42 is_43 is_44 is_45 is_46 is_47 is_48 is_49 is_50 is_51 is_52 is_53 is_54 is_55 is_56 is_57 is_58 is_59 is_60 is_61 is_62 is_63 is_64 is_65 is_66 is_67 is_68 is_69 is_70 is_71 is_72 is_73 is_74 is_75 is_76 is_77 is_78 is_79 is_80 is_81 is_82 is_83 is_84 is_85 is_86 is_87 is_88 is_89 is_90 is_91 is_92 is_93 is_94 is_95 is_96 is_97 is_98 is_99 is_100 is_101 is_102 is_103 is_104 is_105 is_106 is_107 is_108 is_109 is_110 is_111 is_112 is_113 is_114 is_115 is_116 is_117 is_118 is_119 is_120 is_121 is_122 {
    local variable_label : variable label `var'
    local variable_label : subinstr local variable_label "iso2_dest==" ""
    label variable `var' "`variable_label'"
}


foreach var of varlist is_1 is_2 is_3 is_4 is_5 is_6 is_7 is_8 is_9 is_10 is_11 is_12 is_13 is_14 is_15 is_16 is_17 is_18 is_19 is_20 is_21 is_22 is_23 is_24 is_25 is_26 is_27 is_28 is_29 is_30 is_31 is_32 is_33 is_34 is_35 is_36 is_37 is_38 is_39 is_40 is_41 is_42 is_43 is_44 is_45 is_46 is_47 is_48 is_49 is_50 is_51 is_52 is_53 is_54 is_55 is_56 is_57 is_58 is_59 is_60 is_61 is_62 is_63 is_64 is_65 is_66 is_67 is_68 is_69 is_70 is_71 is_72 is_73 is_74 is_75 is_76 is_77 is_78 is_79 is_80 is_81 is_82 is_83 is_84 is_85 is_86 is_87 is_88 is_89 is_90 is_91 is_92 is_93 is_94 is_95 is_96 is_97 is_98 is_99 is_100 is_101 is_102 is_103 is_104 is_105 is_106 is_107 is_108 is_109 is_110 is_111 is_112 is_113 is_114 is_115 is_116 is_117 is_118 is_119 is_120 is_121 is_122 {

gen cit_`var'=`var'*i_tax_rate
    local variable_label : variable label `var'
    label variable cit_`var' "`variable_label'"
}




ppmlhdfe project  cit_is_1 cit_is_2 cit_is_3 cit_is_4 cit_is_5 cit_is_6 cit_is_7 cit_is_8 cit_is_9 cit_is_10 cit_is_11 cit_is_12 cit_is_13 cit_is_14 cit_is_15 cit_is_16 cit_is_17 cit_is_18 cit_is_19 cit_is_20 cit_is_21 cit_is_22 cit_is_23 cit_is_24 cit_is_25 cit_is_26 cit_is_27 cit_is_28 cit_is_29 cit_is_30 cit_is_31 cit_is_32 cit_is_33 cit_is_34 cit_is_35 cit_is_36 cit_is_37 cit_is_38 cit_is_39 cit_is_40 cit_is_41 cit_is_42 cit_is_43 cit_is_44 cit_is_45 cit_is_46 cit_is_47 cit_is_48 cit_is_49 cit_is_50 cit_is_51 cit_is_52 cit_is_53 cit_is_54 cit_is_55 cit_is_56 cit_is_57 cit_is_58 cit_is_59 cit_is_60 cit_is_61 cit_is_62 cit_is_63 cit_is_64 cit_is_65 cit_is_66 cit_is_67 cit_is_68 cit_is_69 cit_is_70 cit_is_71 cit_is_72 cit_is_73 cit_is_74 cit_is_75 cit_is_76 cit_is_77 cit_is_78 cit_is_79 cit_is_80 cit_is_81 cit_is_82 cit_is_83 cit_is_84 cit_is_85 cit_is_86 cit_is_87 cit_is_88 cit_is_89 cit_is_90 cit_is_91 cit_is_92 cit_is_93 cit_is_94 cit_is_95 cit_is_96 cit_is_97 cit_is_98 cit_is_99 cit_is_100 cit_is_101 cit_is_102 cit_is_103 cit_is_104 cit_is_105 cit_is_106 cit_is_107 cit_is_108 cit_is_109 cit_is_110 cit_is_111 cit_is_112 cit_is_113 cit_is_114 cit_is_115 cit_is_116 cit_is_117 cit_is_118 cit_is_119 cit_is_120 cit_is_121 cit_is_122  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
est store taxc



global count1 cit_is_71	cit_is_21	cit_is_29	cit_is_108	cit_is_93	cit_is_13	cit_is_27	cit_is_111	cit_is_104	cit_is_85	cit_is_68	cit_is_30	cit_is_52	cit_is_51	cit_is_38	cit_is_40	cit_is_22	cit_is_42	cit_is_55	cit_is_115	cit_is_5	cit_is_11	cit_is_41	cit_is_84	cit_is_32	cit_is_48	cit_is_23	cit_is_96	cit_is_91	cit_is_47	cit_is_57	cit_is_113	cit_is_20	cit_is_64	

global count2 cit_is_7	cit_is_2	cit_is_34	cit_is_24	cit_is_92	cit_is_43	cit_is_19


coefplot (taxc , mcolor(blue) msize(vsmall)  offset(0)), sort  keep($count1)  xline(0) xtitle("Estimated coefficient", size(vsmall)) ylabel(,labsize(vsmall))  xlabel(-0.7(0.1)0.5 ,labsize(vsmall)  nogrid) graphregion(color(white)) plotregion (margin(b = 0)) aspect(1.5)
graph export "Figure5a.png", as(png) name("Graph") replace
graph export "Figure5a.pdf", as(pdf) name("Graph") replace
graph export "Figure5a.eps", as(eps) name("Graph") replace


coefplot (taxc , mcolor(blue) msize(vsmall)  offset(0)), sort  keep($count2)  xline(0) xtitle("Estimated coefficient", size(vsmall)) ylabel(,labsize(vsmall))  xlabel(-7(1)5 ,labsize(vsmall)  nogrid) graphregion(color(white)) plotregion (margin(b = 0)) aspect(1.5)
graph export "Figure5b.png", as(png) name("Graph") replace
graph export "Figure5b.pdf", as(pdf) name("Graph") replace
graph export "Figure5b.eps", as(eps) name("Graph") replace




*******************************************************************
********************** Estimates from Table 5**********************
*******************************************************************

***********************************************
*** Low-middle vs High Income, col(1)
***********************************************


**** Create interactions for the analysis by income:

gen high_income_dest=0
replace high_income_dest=1 if income_class_dest=="H"

gen high_income_scr=0
replace high_income_scr=1 if income_class_scr=="H"

gen lowinc_lowinc=0
replace lowinc_lowinc=1 if high_income_dest!=1 & high_income_scr!=1

gen lowinc_highinc=0
replace lowinc_highinc=1 if high_income_scr==0 & high_income_dest==1

gen highinc_lowinc=0
replace highinc_lowinc=1 if high_income_scr==1 & high_income_dest==0

gen low_low_cit= i_tax_rate*lowinc_lowinc
label var low_low_cit "x Low-middle to low-middle"  
gen high_low_cit= i_tax_rate*highinc_lowinc
label var high_low_cit "x High to low-middle"  
gen low_high_cit=i_tax_rate*lowinc_highinc
label var low_high_cit "x Low-middle to High"


*** Estimate, income (col 1)

ppmlhdfe project  i_tax_rate high_low_cit low_high_cit low_low_cit   $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store inco


***********************************************
*** Low vs High tax, col(2)
***********************************************
egen median_cit_by_year = median(tax_rate_dest), by(year)


gen tax_high_scr=0
replace tax_high_scr=1 if  median_cit_by_year<=tax_rate_scr


gen tax_high_dest=0
replace tax_high_dest=1 if  median_cit_by_year<=tax_rate_dest

gen txlow_txlow=0
replace txlow_txlow=1 if tax_high_scr==0 & tax_high_dest==0

gen txlow_txhigh=0
replace txlow_txhigh=1 if tax_high_scr==0 & tax_high_dest==1

gen txhigh_txlow=0
replace txhigh_txlow=1 if tax_high_scr==1 & tax_high_dest==0


gen cit_txhigh_txlow= i_tax_rate*txhigh_txlow
label var cit_txhigh_txlow "High tax to low tax"
gen cit_txlow_txhigh= i_tax_rate*txlow_txhigh
label var cit_txlow_txhigh "Low tax to high tax"
gen cit_txlow_txlow= i_tax_rate*txlow_txlow
label var cit_txlow_txlow "Low tax to low tax"

*** Estimate, High low tax (col 2)


ppmlhdfe project  i_tax_rate cit_txhigh_txlow  cit_txlow_txhigh cit_txlow_txlow   $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store txlh



***********************************************
*** Tax havens, col(3)
***********************************************

*** Tax havens classification:

gen tx_hv_dest=0
local mylisto  ABW	AIA	AND	ANT	ATG	BHR	BHS	BLZ	BMU	BRB	CHE	COK	CRI	CYM	CYP	DJI	DMA	FSM	GGY	GIB	GRD	HKG	IMN	IRL	JEY	JOR	KNA	LBN	LBR	LCA	LIE	LUX	MAC	MAF	MCO	MDV	MHL	MLT	MSR	MUS	NIU	NRU	PAN	SGP	SMR	SYC	TCA	TON	VCT	VGB	VUT	WSM
foreach o of local mylisto {
replace tx_hv_dest=1 if ccode_dest=="`o'"
}



gen tx_hv_scr=0
local mylisto  ABW	AIA	AND	ANT	ATG	BHR	BHS	BLZ	BMU	BRB	CHE	COK	CRI	CYM	CYP	DJI	DMA	FSM	GGY	GIB	GRD	HKG	IMN	IRL	JEY	JOR	KNA	LBN	LBR	LCA	LIE	LUX	MAC	MAF	MCO	MDV	MHL	MLT	MSR	MUS	NIU	NRU	PAN	SGP	SMR	SYC	TCA	TON	VCT	VGB	VUT	WSM
foreach o of local mylisto {
replace tx_hv_scr=1 if ccode_scr=="`o'"
}


gen notx_txhv=0
replace notx_txhv=1 if tx_hv_scr==0 & tx_hv_dest==1
label var notx_txhv "No tx hv to Tx. Hv."

gen txhv_notx=0
replace txhv_notx=1 if tx_hv_scr==1 & tx_hv_dest==0
label var txhv_notx "Tx. Hv. to no Tx. Hv."
gen txhv_txhv=0
replace txhv_txhv=1 if tx_hv_scr==1 & tx_hv_dest==1
label var txhv_txhv "Tx. Hv. to Tx. Hv."

gen cit_notx_txhv =notx_txhv*i_tax_rate
label var cit_notx_txhv "x No tx hv to Tx. Hv."

gen cit_txhv_txhv =txhv_txhv*i_tax_rate
label var cit_txhv_txhv "x Tx. Hv. to Tx. Hv."

gen cit_txhv_notx =txhv_notx*i_tax_rate
label var cit_txhv_notx "x Tx. Hv. to no Tx. Hv."


*** Estimate, tax havens (col 3)


ppmlhdfe project  i_tax_rate cit_notx_txhv cit_txhv_notx cit_txhv_txhv   $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store txhv



***********************************************
*** Tax systems, col(4)
***********************************************

gen world_sys_dest=0
replace world_sys_dest=1 if taxsystem_dest=="W"
gen world_sys_scr=0
replace world_sys_scr=1 if taxsystem_scr=="W"

gen world_world=0
replace world_world=1 if world_sys_scr==1 & world_sys_dest==1

gen world_terr=0
replace world_terr=1 if world_sys_scr==1 & world_sys_dest==0

gen terr_world=0
replace terr_world=1 if world_sys_scr==0 & world_sys_dest==1

gen cit_world_world=  world_world*i_tax_rate
label var cit_world_world "x World Tx. Sys. to World Tx. Sys."

gen cit_terr_world=  terr_world*i_tax_rate
label var cit_terr_world "x Territ. Tx. Sys. to World Tx. Sys."

gen cit_world_terr=  world_terr*i_tax_rate
label var cit_world_terr "x World Tx. Sys. to Territ. Tx. Sys."


ppmlhdfe project  i_tax_rate cit_terr_world cit_world_terr cit_world_world   $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store txsy

global interactions high_low_cit low_high_cit low_low_cit cit_txhigh_txlow  cit_txlow_txhigh cit_txlow_txlow  cit_notx_txhv cit_txhv_notx cit_txhv_txhv   cit_terr_world cit_world_terr cit_world_world

esttab inco txlh Table5.tex, pr2  ///
replace nocons mti("Income level" "CIT level" "Tax havens" "Tax system") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(i_tax_rate $interactions $bilat $controls2 $i_rem_gdp_ne $i_rem_tax_ne)  ///
order(i_tax_rate $interactions $bilat $controls2 $i_rem_gdp_ne $i_rem_tax_ne )   ///
label nonotes s(num_n FE1 FE2 FE3 FE4 FE5 FE6 FE7 DO, label("Observations" "Origin" "Destination" "Pair" "Year" "Origin-year" "Destination-year"  "International-year" "Domestic M\&As"))



*******************************************************************
********************** Estimates from Table 6 (and Table A6)*******
********************** Sectoral level analysis*********************
*******************************************************************

use ma_sector_data.dta, clear


*** Add MR and MTR

merge m:1 ccode_dest year using rmt_imp_distgdp_ne.dta
drop _merge

merge m:1 ccode_dest year using rmt_imp_tax_dist.dta
drop _merge

*** International dummy
gen inter=0
replace inter=1 if ccode_scr!=ccode_dest
label var inter "International"

*** Variables interacted by the international dummy
gen i_tax_rate=tax_rate_dest*inter


local mylisto lngdp_d lnlabor_force_dest unemploy_d inflation_dest lnexchange  exports_dest lneco_freedom_h
foreach o of local mylisto {

gen i_`o'= `o'*inter

} 


*** Label variables

label var tax_rate_dest "CIT dest (\%)"
label var i_tax_rate "CIT dest (\%) x INT"
label var lndistw "Distance (log)"
label var contig "Contiguity"
label var comrelig "Religion"
label var comlang_off "Language"
label var col_dep_ever "Colonial ties"
label var rta "RTA"
label var bitforce "BIT" 
label var lnun_dist "Diplomatic distance (log)"
label var allsanctions "Any sanction"
label var lngdp_d "GDP (log)"
label var i_lngdp_d "GDP (log) x inter"
label var lnlabor_force_dest "Labor force (log)"
label var i_lnlabor_force_dest "Labor force (log) x INT"
label var unemploy_d "Unemployment rate"
label var i_unemploy_d "Unemployment rate x INT"
label var inflation_dest "Inflation rate"
label var i_inflation_dest "Inflation rate x INT"
label var lnexchange  "Exchange rate (log)"
label var i_lnexchange  "Exchange rate (log) x INT"
label var exports_dest "Exports (\%GDP)"
label var i_exports_dest "Exports (\%GDP) x INT"
label var lneco_freedom_h "Eco. Freedom (log)"
label var i_eco_freedom_h "Eco. Freedom (log) x INT"

label var lngdp_s "GDP scr (log)"
label var lngdppc_s "GDP pc scr  (log)"







**** Group of variables to be included in the regressions:
global pairdet lndistw contig  comlang_off col_dep_ever 
global controls lngdp_d lnlabor_force_dest unemploy_d inflation_dest lnexchange  exports_dest lneco_freedom_h
global controls2 lngdp_d i_lngdp_d lnlabor_force_dest i_lnlabor_force_dest unemploy_d i_unemploy_d inflation_dest i_inflation_dest lnexchange i_lnexchange  exports_dest i_exports_dest lneco_freedom_h i_eco_freedom_h
global controlsf i_lngdp_d i_lnlabor_force_dest i_unemploy_d i_inflation_dest i_lnexchange  i_exports_dest  i_eco_freedom_h 
global control_source lngdp_s lngdppc_s
global bilat rta bitforce  lnun_dist allsanctions
global controls_scr lngdp_s lnlabor_force_scr unemploy_s inflation_scr lnexchange_scr  exports_scr lneco_freedom_h_scr


**** Define fixed effects

egen pair=group(ccode_scr nace2dg_scr ccode_dest nace2dg_dest) /*  Country pair */
egen oy=group(ccode_scr nace2dg_scr year) /* aquirer-sector-year FE  */
egen dy=group(ccode_dest nace2dg_dest year) /* target-sector-year FE  */
egen brdyr=group(inter year nace2dg_dest) /* International-sector-year FE  */




gen horizontal=0
replace horizontal=1 if nace2dg_scr== nace2dg_dest

gen cit_horizontal= i_tax_rate*horizontal

gen cit_horizontal_dom =tax_rate_dest*horizontal


rename manufacturing manu
rename services serv
*secd2 secd3 secd6 secd7
label var manu "Manufacturing"
label var serv "Services"
	local mylistt 	secd1 secd4 secd5 secd8 manu serv 
foreach t of local mylistt {
	
local lbl: variable label `t'
gen cit_`t'= i_tax_rate*`t'
label var cit_`t' "x `lbl'"

}



ppmlhdfe project  tax_rate_dest i_tax_rate  $controls2 $bilat $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne, absorb(pair oy brdyr) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store int0


ppmlhdfe project  i_tax_rate $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store int1

ppmlhdfe project  i_tax_rate cit_horizontal $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store int2


ppmlhdfe project  i_tax_rate cit_secd1 cit_secd4 cit_secd5 cit_secd8 cit_manu $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store int3



esttab int0 int1 int2 int3 using Table6.rtf, pr2  ///
replace nocons mti("Domestic" "Main" "Horizontal" "Sectoral level effect") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(tax_rate_dest i_tax_rate cit_horizontal cit_secd5 cit_secd4 cit_manu cit_secd8 cit_secd1 $bilat $controls2 $rem_gdp_ne  $i_rem_gdp_ne $rem_tax_ne $i_rem_tax_ne)  ///
order(tax_rate_dest i_tax_rate cit_horizontal cit_secd5 cit_secd4 cit_manu cit_secd8 cit_secd1 $bilat $controls2 $rem_gdp_ne  $i_rem_gdp_ne $rem_tax_ne $i_rem_tax_ne)   ///
label nonotes s(num_n FE1 FE2 FE3 FE4 FE5 DO, label("Observations" "Source-sector-year" "Destination" "Destination-sector-year" "Pair"  "International-year" "Domestic M\&As"))



*************************************************************************************************************
*************************************************************************************************************
*************************************************************************************************************
********Estimates reported in the Appendix*******************************************************************
*************************************************************************************************************
*************************************************************************************************************
*************************************************************************************************************


use ma_country_data.dta, clear
*** International dummy
gen inter=0
replace inter=1 if ccode_scr!=ccode_dest
label var inter "International"

*** Variables interacted by the international dummy
gen i_tax_rate=tax_rate_dest*inter


local mylisto lngdp_d lnlabor_force_dest unemploy_d inflation_dest lnexchange  exports_dest lneco_freedom_h
foreach o of local mylisto {

gen i_`o'= `o'*inter

} 


*** Label variables

label var tax_rate_dest "CIT dest (\%)"
label var i_tax_rate "CIT dest (\%) x INT"
label var lndistw "Distance (log)"
label var contig "Contiguity"
label var comrelig "Religion"
label var comlang_off "Language"
label var col_dep_ever "Colonial ties"
label var rta "RTA"
label var bitforce "BIT" 
label var lnun_dist "Diplomatic distance (log)"
label var allsanctions "Any sanction"
label var lngdp_d "GDP (log)"
label var i_lngdp_d "GDP (log) x inter"
label var lnlabor_force_dest "Labor force (log)"
label var i_lnlabor_force_dest "Labor force (log) x INT"
label var unemploy_d "Unemployment rate"
label var i_unemploy_d "Unemployment rate x INT"
label var inflation_dest "Inflation rate"
label var i_inflation_dest "Inflation rate x INT"
label var lnexchange  "Exchange rate (log)"
label var i_lnexchange  "Exchange rate (log) x INT"
label var exports_dest "Exports (\%GDP)"
label var i_exports_dest "Exports (\%GDP) x INT"
label var lneco_freedom_h "Eco. Freedom (log)"
label var i_eco_freedom_h "Eco. Freedom (log) x INT"

label var lngdp_s "GDP scr (log)"
label var lngdppc_s "GDP pc scr  (log)"







**** Group of variables to be included in the regressions:
global pairdet lndistw contig  comlang_off col_dep_ever 
global controls lngdp_d lnlabor_force_dest unemploy_d inflation_dest lnexchange  exports_dest lneco_freedom_h
global controls2 lngdp_d i_lngdp_d lnlabor_force_dest i_lnlabor_force_dest unemploy_d i_unemploy_d inflation_dest i_inflation_dest lnexchange i_lnexchange  exports_dest i_exports_dest lneco_freedom_h i_eco_freedom_h
global controlsf i_lngdp_d i_lnlabor_force_dest i_unemploy_d i_inflation_dest i_lnexchange  i_exports_dest  i_eco_freedom_h 
global control_source lngdp_s lngdppc_s
global bilat rta bitforce  lnun_dist allsanctions
global controls_scr lngdp_s lnlabor_force_scr unemploy_s inflation_scr lnexchange_scr  exports_scr lneco_freedom_h_scr


**** Define fixed effects

egen pair=group(ccode_scr ccode_dest) /*  Country pair */
egen scr=group(ccode_scr) /* Aquirer FE  */
egen dest=group(ccode_dest) /*  Target FE */
egen oy=group(ccode_scr year) /* aquirer-year FE  */
egen dy=group(ccode_dest year) /* target-year FE  */
egen brdyr=group(inter year) /* International-year FE  */




gen logproject=ln(project)
gen logproject1=log(project+1)


********* Restrict sample so the sample of analysis is always the same and does not change as a result of including new independent variables or excluding domestic transactions:

****** Restrict sample:
ppmlhdfe project  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg7
gen sample=e(sample)
keep if sample==1
drop sample 




ppmlhdfe project tax_rate_dest  $pairdet $controls $bilat if ccode_scr!=ccode_dest, absorb(dest oy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store ereg1
gen sample_int=e(sample)

preserve
keep if sample_int==1
egen codeyear=group(ccode_dest year)
duplicates drop codeyear, force
keep ccode_dest year
gen sample_dest=1
save sample_dest.dta, replace
restore

preserve
keep if sample_int==1
egen codeyear=group(ccode_scr year)
duplicates drop ccode_scr year, force
keep ccode_scr year
gen sample_scr=1
save sample_scr.dta, replace
restore

merge m:1 ccode_dest year using sample_dest.dta
keep if _merge==3
drop _merge

merge m:1 ccode_scr year using sample_scr.dta
keep if _merge==3
drop _merge sample_dest sample_scr

ppmlhdfe project  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg7
keep if _est_ereg7==1


*******************************************************************
***** Table A.2. 
*******************************************************************



reghdfe logproject1 tax_rate_dest  $pairdet $controls $bilat if ccode_scr!=ccode_dest, absorb(dest oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store ols2


nbreg project tax_rate_dest  $pairdet $controls $bilat exp_ny_* imp_* if ccode_scr!=ccode_dest, vce(robust)
eststo m2: margins, eydx(tax_rate_dest  $pairdet $controls $bilat) post
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store poi2a

nbreg logproject1 tax_rate_dest  $pairdet $controls $bilat exp_ny_* imp_* if ccode_scr!=ccode_dest, vce(robust)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store poi2b



tobit project tax_rate_dest  $pairdet $controls $bilat imp_* exp_ny_* if ccode_scr!=ccode_dest, ll(0) vce(robust) 
eststo m1: margins, predict(ystar(0,.)) eydx(tax_rate_dest  $pairdet $controls $bilat) post
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store tob4a

tobit logproject1 tax_rate_dest  $pairdet $controls $bilat imp_* exp_ny_* if ccode_scr!=ccode_dest, ll(0) vce(robust) 
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store tob4b

poisson project tax_rate_dest  $pairdet $controls $bilat exp_ny_* imp_* if ccode_scr!=ccode_dest, vce(robust)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store poi1



ppmlhdfe project tax_rate_dest  $pairdet $controls $bilat if ccode_scr!=ccode_dest, absorb(dest oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store ppml1



reghdfe logproject tax_rate_dest  $pairdet $controls $bilat if ccode_scr!=ccode_dest, absorb(dest oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store ols1


ppmlhdfe project tax_rate_dest  $pairdet $controls $bilat if ccode_scr!=ccode_dest & project!=0, absorb(dest oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store ppml2


esttab ols2 poi2a poi2b tob4a tob4b poi1 ppml1 ols1 ppml2 using TableA2.tex, pr2  ///
replace nocons mti("OLS with 0s"  "Negative binomial ey" "nb log" "Tobit ey" "Tobit log" "Poisson"  "PPML with 0s"  "OLS no 0s" "PPML no 0s") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(tax_rate_dest  $pairdet $controls $bilat)  ///
order(tax_rate_dest  $pairdet $controls $bilat )   ///
label nonotes s(num_n FE1 FE2 FE3 FE4 FE5 DO, label("Observations" "Origin-year" "Destination" "Destination-year" "Pair"  "International-year" "Domestic M\&As"))


*******************************************************************
********************** Estimates from Table A7*********************
*******************************************************************


**** OLS log(project)


reghdfe logproject tax_rate_dest  $pairdet $controls $bilat if ccode_scr!=ccode_dest, absorb(dest oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 ""
estadd local FE5 ""
estadd local DO "No"
est store ereg1


reghdfe logproject tax_rate_dest $controls $bilat if ccode_scr!=ccode_dest, absorb(pair oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 ""
estadd local DO "No"
est store ereg2



reghdfe logproject  tax_rate_dest $controls $bilat $rem_gdp_ne $rem_tax_ne if ccode_scr!=ccode_dest, absorb(pair oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 ""
estadd local DO "No"
est store ereg3

reghdfe logproject  tax_rate_dest $controls $bilat $rem_gdp_ne $rem_tax_ne, absorb(pair oy brdyr) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg4

reghdfe logproject  tax_rate_dest i_tax_rate $controls2 $bilat $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne, absorb(pair oy brdyr) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg5

reghdfe logproject  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg6


esttab ereg1 ereg2 ereg3 ereg4 ereg5 ereg6 using TableA7.tex, pr2  ///
replace nocons mti("Naive" "Pair FEs" "MRT GDP \& tax" "Domestic" "$X_{jt}*Inter$" "Main") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(tax_rate_dest i_tax_rate $pairdet $bilat $controls2 $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne)  ///
order(tax_rate_dest i_tax_rate $pairdet $bilat $controls2 $rem_gdp_ne $i_rem_gdp_ne  $rem_tax_ne $i_rem_tax_ne )   ///
label nonotes s(num_n FE1 FE2 FE3 FE4 FE5 DO, label("Observations" "Origin-year" "Destination" "Destination-year" "Pair"  "International-year" "Domestic M\&As"))





*******************************************************************
********************** Estimates Figure A1*************************
*******************************************************************


local mylistd	1996	1997	1998	1999	2000	2001	2002	2003	2004	2005	2006	2007	2008	2009	2010	2011	2012	2013	2014	2015	2016	2017	2018	2019

 foreach d of local mylistd {
gen inter`d'=0
replace inter`d'=1 if year==`d' & inter==1
label var inter`d' "`d'"
}


global international inter1996 inter1997 inter1998 inter1999 inter2000 inter2001 inter2002 inter2003 inter2004 inter2005 inter2006 inter2007 inter2008 inter2009 inter2010 inter2011 inter2012 inter2013 inter2014 inter2015 inter2016 inter2017 inter2018 inter2019




reghdfe logproject  tax_rate_dest $controls $bilat $rem_gdp_ne $rem_tax_ne $international, absorb(oy pair) vce(cluster pair) 
est store olsbr

coefplot (olsbr, mcolor(blue)  offset(0) ciopts(recast(rarea)  lwidth(0) color(blue%50) fintensity(40))),  keep($international) vertical yline(0)   xlabel(,labsize(vsmall))  ylabel(-1.2(0.2)0.4 ,labsize(vsmall) nogrid) graphregion(color(white)) plotregion (margin(b = 0)) aspect(0.60)
graph save "Graph" "FigureA1.gph", replace
graph export "FigureA1.png", as(png) name("Graph") replace
graph export "FigureA1.pdf", as(pdf) name("Graph") replace
graph export "FigureA1.eps", as(eps) name("Graph") replace

*******************************************************************
********************** Estimates Figure A2*************************
*******************************************************************

reghdfe logproject1  tax_rate_dest $controls $bilat $rem_gdp_ne $rem_tax_ne $international, absorb(oy pair) vce(cluster pair) 
est store olsbr

coefplot (olsbr, mcolor(blue)  offset(0) ciopts(recast(rarea)  lwidth(0) color(blue%50) fintensity(40))),  keep($international) vertical yline(0)   xlabel(,labsize(vsmall))  ylabel(-1.2(0.2)0.4 ,labsize(vsmall) nogrid) graphregion(color(white)) plotregion (margin(b = 0)) aspect(0.60)
graph save "Graph" "FigureA2.gph", replace
graph export "FigureA2.png", as(png) name("Graph") replace
graph export "FigureA2.pdf", as(pdf) name("Graph") replace
graph export "FigureA2.eps", as(eps) name("Graph") replac


*******************************************************************
********************** Estimates from Table A8*********************
*******************************************************************

reghdfe logproject1  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 ""
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 ""
estadd local FE5 "X"
estadd local FE6 "X"
estadd local FE7 "X"
estadd local DO "Yes"
est store ereg1



gen ihsproject=log( project + sqrt(project^2 + 1))

reghdfe ihsproject  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg2


reghdfe project  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 ""
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 ""
estadd local FE5 "X"
estadd local FE6 "X"
estadd local FE7 "X"
estadd local DO "Yes"
est store ereg3


ppmlhdfe project i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne if project>0, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 ""
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 ""
estadd local FE5 "X"
estadd local FE6 "X"
estadd local FE7 "X"
estadd local DO "Yes"
est store ereg4


ppmlhdfe project i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster scr dest) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 ""
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 ""
estadd local FE5 "X"
estadd local FE6 "X"
estadd local FE7 "X"
estadd local DO "Yes"
est store ereg5

ppmlhdfe project i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster scr dest year) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 ""
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 ""
estadd local FE5 "X"
estadd local FE6 "X"
estadd local FE7 "X"
estadd local DO "Yes"
est store ereg6




***IPP


local mylistd	1995 1996	1997	1998	1999	2000	2001	2002	2003	2004	2005	2006	2007	2008	2009	2010	2011	2012	2013	2014	2015	2016	2017	2018	2019

 foreach d of local mylistd {
gen inter`d'=0
replace inter`d'=1 if year==`d' & inter==1
label var inter`d' "`d'"
}


global international inter1996 inter1997 inter1998 inter1999 inter2000 inter2001 inter2002 inter2003 inter2004 inter2005 inter2006 inter2007 inter2008 inter2009 inter2010 inter2011 inter2012 inter2013 inter2014 inter2015 inter2016 inter2017 inter2018 inter2019

ppmlhdfe project  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne $international, absorb(oy pair dy) vce(cluster pair) d
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store base1







predict lambda
        matrix beta = e(b)
        ppml_fe_bias project  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne $international, i(scr) j(dest) t(year) lambda(lambda) beta(beta)  
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store  ereg7

drop $international



esttab ereg1 ereg2 ereg3 ereg4 ereg5 ereg6 ereg7  using TableA8.tex, pr2  ///
replace nocons mti("OLS log(project+1)" "IHS" "OLS level" "PPML no 0s" "Two way clustering" "Three way clustering" "IPP") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(i_tax_rate $bilat $controlsf $i_rem_gdp_ne $i_rem_tax_ne)  ///
order(i_tax_rate $bilat $controlsf $i_rem_gdp_ne $i_rem_tax_ne )   ///
label nonotes s(num_n FE1 FE2 FE3 FE4 FE5 FE6 FE7 DO, label("Observations" "Origin" "Destination" "Pair" "Year" "Origin-year" "Destination-year"  "International-year" "Domestic M\&As"))


*******************************************************************
********************** Estimates from Table A9*********************
*******************************************************************

merge m:1 ccode_dest year using rmtns_imp2
drop _merge


merge m:1 ccode_dest year using rmtns_imp_tax
drop _merge

gen i_rmt_imp_tax=rmt_imp_tax*inter
gen i_rmt_imp =rmt_imp*inter

label var rmt_imp "Dest MR, w. GDP"
label var rmt_imp_tax "Dest MTR, w. tax"

label var i_rmt_imp "Dest MR, w. GDP x INT"
label var i_rmt_imp_tax "Dest MTR, w. tax x INT"


ppmlhdfe project  tax_rate_dest $controls $bilat rmt_imp rmt_imp_tax if ccode_scr!=ccode_dest, absorb(pair oy) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 ""
estadd local DO "No"
est store ereg1

ppmlhdfe project  tax_rate_dest $controls $bilat rmt_imp rmt_imp_tax, absorb(pair oy brdyr) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg2

ppmlhdfe project  tax_rate_dest i_tax_rate $controls2 $bilat rmt_imp i_rmt_imp rmt_imp_tax i_rmt_imp_tax, absorb(pair oy brdyr) vce(cluster pair)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg3

ppmlhdfe project  i_tax_rate  $controlsf $bilat i_rmt_imp i_rmt_imp_tax, absorb(oy pair brdyr dy) vce(cluster pair) 
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg4

esttab ereg1 ereg2 ereg3 ereg4 using Table9A.rtf, pr2  ///
replace nocons mti("MRT GDP \& tax" "Domestic" "$X_{jt}*Inter$" "Main") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(tax_rate_dest i_tax_rate  $bilat $controls2 rmt_imp i_rmt_imp rmt_imp_tax i_rmt_imp_tax)  ///
order(tax_rate_dest i_tax_rate $bilat $controls2 rmt_imp i_rmt_imp rmt_imp_tax i_rmt_imp_tax)   ///
label nonotes s(num_n FE1 FE2 FE3 FE4 FE5 DO, label("Observations" "Origin-year" "Destination" "Destination-year" "Pair"  "International-year" "Domestic M\&As"))

esttab ereg3 ereg4 ereg5 ereg6 ereg7 using Country_CIT_paper_robustMRMTR.tex, pr2  ///
replace nocons mti("MRT GDP" "MRT GDP \& tax" "Domestic" "$X_{jt}*Inter$" "Main") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(tax_rate_dest i_tax_rate  $bilat $controls2 rmt_imp i_rmt_imp rmt_imp_tax i_rmt_imp_tax)  ///
order(tax_rate_dest i_tax_rate $bilat $controls2 rmt_imp i_rmt_imp rmt_imp_tax i_rmt_imp_tax)   ///
label nonotes s(num_n FE1 FE2 FE3 FE4 FE5 DO, label("Observations" "Origin-year" "Destination" "Destination-year" "Pair"  "International-year" "Domestic M\&As"))

*******************************************************************
********************** Estimates from Table A10********************
*******************************************************************


ppmlhdfe project tax_rate_dest  $pairdet $control_source $controls $bilat if ccode_scr!=ccode_dest, absorb(dest scr year) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 "X"
estadd local FE3 ""
estadd local FE4 "X"
estadd local FE5 ""
estadd local DO "No"
est store ereg1

ppmlhdfe project tax_rate_dest $control_source $controls $bilat if ccode_scr!=ccode_dest, absorb(pair year) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 ""
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 ""
estadd local DO "No"
est store ereg2


ppmlhdfe project  tax_rate_dest $control_source $controls $bilat $rem_gdp_ne $rem_tax_ne if ccode_scr!=ccode_dest, absorb(pair year) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 ""
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 ""
estadd local DO "No"
est store ereg3

ppmlhdfe project  tax_rate_dest $control_source $controls $bilat $rem_gdp_ne $rem_tax_ne, absorb(pair year brdyr) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 ""
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store ereg4



esttab ereg1 ereg2 ereg3 ereg4 using TableA10.tex, pr2  ///
replace nocons mti("Benchmark"  "PPML pair FE" "MR and MTR" "Domestic") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(tax_rate_dest $pairdet $bilat $control_source $controls $rem_gdp_ne $rem_tax_ne)  ///
order(tax_rate_dest $pairdet $bilat $control_source $controls $rem_gdp_ne $rem_tax_ne )   ///
label nonotes s(num_n FE1 FE2 FE3 FE4 FE5 DO, label("Observations" "Origin" "Destination" "Pair" "Year"  "International-year" "Domestic M\&As"))




*******************************************************************
********************** Estimates from Table A11********************
*******************************************************************


ppmlhdfe project  i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store cit0


ppmlhdfe project  li_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store cit1

ppmlhdfe project  l2i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store cit2

ppmlhdfe project  li_tax_rate l2i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store cit3

ppmlhdfe project i_tax_rate li_tax_rate l2i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne, absorb(oy pair brdyr dy) vce(cluster pair) sep(fe)
local k=e(N)
local r=  e(r2_p)
estadd local num_n `k'
estadd local FE1 "X"
estadd local FE2 ""
estadd local FE3 "X"
estadd local FE4 "X"
estadd local FE5 "X"
estadd local DO "Yes"
est store cit4



esttab cit0 cit1 cit2 cit3 cit4 using TableA11.tex, pr2  ///
replace nocons mti("Main" "t-1" "t-2" "t-1 and t-2" "All") star(* 0.10 ** 0.05 *** 0.01) b(3) se(3)  ///
keep(i_tax_rate li_tax_rate l2i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne)  ///
order(i_tax_rate li_tax_rate l2i_tax_rate  $controlsf $bilat $i_rem_gdp_ne $i_rem_tax_ne )   ///
label nonotes s(num_n FE1 FE2 FE3 FE4 FE5 DO, label("Observations" "Origin-year" "Destination" "Destination-year" "Pair"  "International-year" "Domestic M\&As"))

